﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.DALFactory;

namespace KPIS.GERP.GHRMS.BLL
{
    public class RoyalItemTypeBLL : IRoyalItemTypeBLL
    {
        private static readonly IRoyalItemTypeDAL dal = DataAccess.CreateRoyalItemTypes();

        public IList<RoyalItemTypeInfo> ListRoyalItemTypes()
        {
            return dal.ListRoyalItemTypes(new RoyalItemTypeInfo(0));
        }
        public IList<RoyalItemTypeInfo> ListRoyalItemTypesBySequence(int Sequence)
        {
            return dal.ListRoyalItemTypes(new RoyalItemTypeInfo(Sequence));
        }

        public void Insert(string Code, string Name, string Remarks, int CreatedBy)
        {
            try
            {
                dal.Insert(new RoyalItemTypeInfo(0, Code, Name, Remarks, "", CreatedBy, 0));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Code, string Name, string Remarks, int UpdatedBy)
        {
            try
            {
                dal.Update(new RoyalItemTypeInfo(Sequence, Code, Name, Remarks, "", 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                dal.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
    }
}
